Private Sub BackgroundWorker1_DoWork(sender As System.Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork Dim worker As BackgroundWorker = CType(sender, BackgroundWorker) Const pp As Single = 2 Dim trace As Integer Dim txt1$ trace = 0 If trace_pp = 1 Then trace = 1 state2(pp) = 0 If trace = 1 Then txt1$ = " BackgroundWorker1 np" + Str(np) + " " + Str(npl(pp)) + " state" + Str(state1(pp)) Debug.Print(txt1$) End If Do If state1(pp) = StartSt Then state2(pp) = ActiveSt state1(pp) = 0 ' Compute One Iteration cycle pp=2 If trace = 1 Then Debug.Print(" BackgroundWorker1 np" + Str(np) + " " + Str(npl(pp)) + " state" + Str(state1(pp))) If np <> npl(pp) Then Debug.Print(" BackgroundWorker1 ERROR np" + Str(np) + " " + Str(npl(pp)) + " state" + Str(state1(pp))) : npl(pp) = np If methode = 1 Then Methode_1_PP(pp) Else Methode_2_PP(pp) End If state2(pp) = FinishedSt Else System.Threading.Thread.Sleep(1) End If Loop Until state1(pp) = CancelSt state2(pp) = Endst state1(pp) = 0 End Sub